package com.data.center.service.mongo;

import com.data.center.entity.mongo.organization ;
import com.data.center.mapper.mongo.OrganizationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;
@Service
public class OrganizationService {
    @Autowired
    private OrganizationRepository repository;

    public organization saveOrganization(organization organization) {
        return repository.save(organization);
    }

    public Optional<organization> getOrganizationById(String id) {
        return repository.findById(id);
    }

    public organization getOrganizationByOrganizationId(String organizationId) {
        return repository.findByOrganizationId(organizationId);
    }

    public List<organization> getAllOrganizations() {
        return repository.findAll();
    }

    public void deleteOrganization(String id) {
        repository.deleteById(id);
    }
}
